#include <iostream>
#include <vector>

using namespace std;

int canCompleteCircuit(vector<int>& gas, vector<int>& cost) {
    int n = gas.size();
    for (int i = 0; i < n; ++i)
    {
        int ret = 0;
        int step = 0;
        while (step < n)
        {
            int index = (i + step) % n;

            ret += (gas[index] - cost[index]);

            if (ret < 0)
                break;
            step++;
        }
        if (ret >= 0)
            return i;
        i += step;
    }

    return -1;
}

int main()
{

	return 0;
}